<!-- BEGIN:main -->

<script type="text/javascript">
    function group_drop_box_change(){
        if (document.getElementById('groupbox').value > 0){
            document.getElementById('ext_info').setAttribute('style', 'display:block;');
        }else{
            document.getElementById('ext_info').setAttribute('style', 'display:block;');
        }
    }
    function client_check_register(){
        password = document.getElementById('password1_tpl').value;
        password2= document.getElementById('password2_tpl').value;
        document.getElementById('password1').value = MD5(password);
        document.getElementById('password2').value = MD5(password2);
        username = document.getElementById('username').value;
        
        if (password=="" || username==""){
            alert("Please enter the username and the password!");
            document.getElementById('username').focus();
            return false;
        }

        if (password!=password2){
            alert("Password does not match!");
            document.getElementById('password1_tpl').focus();
            return false;
        };
        
        if (document.getElementById('groupbox').value==0){
            alert("Please select a group!");
            return false;
        }

        return true;
    }
</script>
<div id="page_title">
    <h2>Add new user</h2>
</div>
{MSG}
<form action="" method="POST" onsubmit="return client_check_register()">
    <table class="panel" id="form">
        <tr>
            <td><label for="username">Username:</label></td>
            <td width="70%"><input type="text" name="username" id="username" maxlength="30" size="40" value=""/></td>
        </tr>
        <tr>
            <td><label for="displayname">Displayname:</label></td>
            <td width="70%"><input type="text" name="displayname" id="displayname" maxlength="50" size="40" value=""/></td>
        </tr>
        <tr>
            <td><label for="password1_tpl">Password:</label></td>
            <td><input type="password" name="password1_tpl" id="password1_tpl" maxlength="50" size="40" value=""/>
                <input type="hidden" name="password1" id="password1">
            </td>
        </tr>
        <tr>
            <td><label for="Retype password">Password again:</label></td>
            <td><input type="password" name="password2_tpl" id="password2_tpl" maxlength="50" size="40" value=""/><br>
                <input type="hidden" name="password2" id="password2">
            </td>
         </tr>
         <tr>
            <td><label for="group">Group:</label></td>
            <td width="70%">         
                {GROUPBOX}
<!--                <select name="group" id="groupbox" return false;">
    <option value="'.$rows[$i][0].'">'.$rows[$i][1].'</option>
    </select>-->
            </td>
        </tr>
        <script type="text/javascript">
         
            $(document).ready(function(){
            $("#groupbox").ready(function(){
                $(".ext_adviser_info").hide();
                $(".ext_stdent_info").hide();
                });
            });
            $(document).ready(function(){
             $("#groupbox").change(function(){
              
                $('html, body').animate({scrollTop: $(document).height()},1500);
                if(this.value != 1){
                    $(".ext_adviser_info").fadeOut();
                }else{
                    $(".ext_adviser_info").fadeIn();
                }
                if(this.value != 2){
                    $(".ext_stdent_info").fadeOut();
                }else{
                    $(".ext_stdent_info").fadeIn();
                }
              });
            });
        </script>
            <tr class="ext_stdent_info" >
                <td>Điểm học tập:</td>
                <td width="70%"><input type="text" name="diemhoctap" id="diemhoctap" maxlength="50" size="40" value=""/></td>
            </tr>
            <tr class="ext_stdent_info" >
                <td>Điểm rèn luyện:</td>
                <td width="70%"><input type="text" name="diemrenluyen" id="diemrenluyen" maxlength="50" size="40" value=""/></td>
            </tr>
            <tr class="ext_stdent_info" >
                <td>Thông tin sinh viên:</td>
                <td width="70%"><textarea  name="student_info" id="student_info" maxlength="1000" value=""/></textarea></td>
            </tr>
            <tr class="ext_adviser_info" >
                <td>Thông tin giảng viên:</td>
                <td width="70%"><textarea  name="adviser_info" id="adviser_info" maxlength="1000" value=""/></textarea></td>
            </tr>
         <tr>
             <td></td><td><input class="button" type="submit" name="submit" id="submit" value="Create" style="margin-top:10px;"/></td>
        </tr>
    
    </table>
    
</form>



<!-- END:main -->

<!-- BEGIN:success_msg -->
<div id="msg" style="text-align:center;">One user have been added!</div>
<div class="toolbar" style="text-align:center;">{TOOLBAR_LINKS}</div>
<!-- END:success_msg -->


